<template>
<Row class="layout-content-body">
  <dtable :columnsList="columns" v-model="dataAll" :totals="total" 
   check  approve read flowStatus @approveClick="approveClick" @get="get"
  @refresh="getall()"  :loading="loading"></dtable>
</Row>
</template>

<script>
import {
  timeFormat, currency
} from '@/common/filter'
import dtable from '@/components/table/etable.vue' //采用biztable
export default {
  data() {
    return {
      loading: false, //数据刷新遮罩层
      columns: [
        //多选框
        {
          title: '名称',
          key: 'Name',
          sortable: true
        },
        {
          title: '供应商',
          key: 'PartName',
          sortable: true
        },
        {
          title: '金额',
          key: 'Price',
          sortable: true,
          render: (h, params) => {
            return h('div', [
              h('strong', currency(params.row.Price,"￥"))
            ]);
          }
        },
        {
          title: '说明',
          key: 'Remark',
          sortable: true,
        },
        {
          title: '责任人',
          key: 'Creater',
          sortable: true
        },
        {
          title: '创建时间',
          key: 'Ctime',
          sortable: true,
          render: (h, params) => {
            return h('div', [
              h('strong', timeFormat(params.row.Ctime))
            ]);
          }
        },
      ], //表格样式
      dataAll: [], //表格数据来源
      templist: [],
      dataShow: true, //是否显示表格数据查看表单
      showTemp: false,
      total: 0,
      orderData: {
        edit: true,
        temp: ''
      },
    }
  },
  components: {
    dtable,
  },
  computed: {

  },
  watch: {},
  methods: {
    getall() {
      this.loading = true
      let data={
        busyName:"yjk_buy"
      }
      this.$api.getAssetsbuyDoing(data).then(res => {
        console.debug(res.Data)
        if (!res.error) {
          this.dataAll = res.Data
          if (this.dataAll) {
            this.total = (this.dataAll).length
          }
        } else {
          this.$Message.error(res.message)
        }
      })
      this.loading = false;
    },
    
    asyncOK() {
      this.$router.push({
        name: '采购订单明细',
        params: {
          orderData: this.orderData
        }
      })
    },  
    approveClick  (data) {
      this.orderData.order = data
      this.orderData.edit=true
      this.$router.push({
        name: '采购订单审批',
        params: {
          orderData: this.orderData
        }
      })
    },  
    get(data) {
      this.orderData.order = data
      this.orderData.edit=false
      this.$router.push({
        name: '采购订单审批',
        params: {
          orderData: this.orderData
        }
      })
    },   
  },
  mounted() {
    this.getall()
  }
}
</script>
